
const MonacoWebpackPlugin = require("monaco-editor-webpack-plugin");
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
module.exports = {
  css: {
    loaderOptions: {
      scss: {
        "resolve url": true,
        import: ["./src/assets/index.scss"],
      },
    },
  },
  chainWebpack: (config) => {
    config.plugin('webpack-bundle-analyzer').use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin)
    const oneOfsMap = config.module.rule("scss").oneOfs.store;
    oneOfsMap.forEach((item) => {
      item
        .use("sass-resources-loader")
        .loader("sass-resources-loader")
        .options({
          // 公用scss
          resources: "./src/assets/index.scss",
        })
        .end();
    });
  },
  configureWebpack: {
    plugins: [
      new MonacoWebpackPlugin({
        languages:["javascript","css","html","json"],
        features:["coreCommands","find"]
      })
    ]
  },
  devServer: {
    proxy: {
      '/nd': {
        target: 'http://127.0.0.1:8090',
        changeOrigin: true,
        pathRewrite: {
          '^nd/': 'nd/'
        }
      }
    }
  }
};
